/*
 * @Author: your name
 * @Date: 2021-08-10 14:24:43
 * @LastEditTime: 2021-08-10 20:32:57
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \hrsaas-86\src\api\setting.js
 */
/**
 * 获取角色列表
 * ***/
import request from '@/utils/request'

export const reqGetRoleList = (page, pagesize) =>
  request({
    method: 'get',
    url: '/sys/role',
    params: {
      page, // 页码
      pagesize // 每页条数
    }
  })
/**
 * 删除角色
 ***/
export function reqDeleteRole(id) {
  return request({
    url: `/sys/role/${id}`,
    method: 'delete'
  })
}

/** *
 * 新增角色
 * ***/
export function reqAddRole(data) {
  return request({
    url: '/sys/role',
    data,
    method: 'post'
  })
}
/** *
 * 修改角色
 * **/
export function reqUpdateRole(data) {
  return request({
    method: 'put',
    url: `/sys/role/${data.id}`,
    data
  })
}

/**
 * 根据 id 获取角色详情, 用于回显
 * **/
export function reqGetRoleDetail(id) {
  return request({
    method: 'get',
    url: `/sys/role/${id}`
  })
}
